package com.mai4j.maiadmin.exception;

import com.mai4j.maiadmin.model.RespCode;
import lombok.Getter;
import lombok.Setter;

/**
 * 用户异常
 */
@Getter
@Setter
public class BusinessException extends RuntimeException {
    /**
     * 异常代码
     */
    private RespCode code;
    /**
     * 异常代码
     */
    private RespCode subCode;
    /**
     * 异常信息
     */
    private String message;
    /**
     * Message是否为messages的key
     */
    private boolean key;

    public BusinessException(RespCode code, RespCode subCode, String message) {
        this(code, subCode, message, true);
    }

    public BusinessException(RespCode code, RespCode subCode, String message, boolean key) {
        this.code = code;
        this.subCode = subCode;
        this.message = message;
        this.key = key;
    }
}
